package com.ruoyi.web.controller.util;

import cn.hutool.crypto.symmetric.AES;

import java.net.URLEncoder;

public class AESUtil {
    private static final String AES = "AES";

    private static final String  key="N4BN635YI5XS7S56";
    private static final String  Iv="DYgjCEIMVrj2W9xN";

    public static String encrypt(String content) throws Exception {
        cn.hutool.crypto.symmetric.AES aes = new AES("CBC", "PKCS7Padding",
                // 密钥，可以自定义
                key.getBytes(),
                Iv.getBytes());
        return aes.decryptStr(content);
    }


    // 解密
    public static String decrypt(String content) throws Exception {
        cn.hutool.crypto.symmetric.AES aes = new AES("CBC", "PKCS7Padding",
                // 密钥，可以自定义
                key.getBytes(),
                Iv.getBytes());
        return aes.encryptHex(content);
    }


}